import gdRequest from '@/utils/gdRequest'


// 导出路线备案
export function getAmapRouteListApi(startCoodr, endCoodr) {
  let key = "1f98fad916096ae72ec865d166217b49";
  let startLon = startCoodr.lon;
  let startLat = startCoodr.lat;
  let desLon = endCoodr.lon;
  let deslat = endCoodr.lat;

  let gaodeUrl =
    'https://restapi.amap.com/v3/direction/driving?key=' + key + '&origin=' + startLon + ',' + startLat + '&destination=' + desLon + ',' + deslat + '&extensions=base';

  return gdRequest({
    url: gaodeUrl,
    method: 'get'
  })
}


export function getAmapRouteListApi1(startCoodr, endCoodr) {

  let key = "1f98fad916096ae72ec865d166217b49";
  let startLon = startCoodr.lon;
  let startLat = startCoodr.lat;
  let desLon = endCoodr.lon;
  let deslat = endCoodr.lat;

  let url =
    'https://restapi.amap.com/v3/direction/driving?key=' + key + '&origin=' + startLon + ',' + startLat + '&destination=' + desLon + ',' + deslat + '&extensions=base';
  return axios.get(url)
    .then(function (value) {
      console.log(value);
    })
    .catch(function (reason) {
      console.log(reason);
    })
}
